<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增影视管理')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-film-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label ">年度：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="annual" class="form-control" placeholder="yyyy-MM-dd" type="text" >
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">影视名称：</label>
                <div class="col-sm-8">
                    <input name="tvSeries" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">海报图：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="img">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="img" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">剧情简介：</label>
                <div class="col-sm-8">
                    <textarea name="topicContent" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">影视类型：</label>
                <div class="col-sm-8" th:with="type=${@dict.getType('ds_film_type')}">
                    <label th:each="dict : ${type}" class="check-box">
                        <input name="type" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}">
                    </label>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">导演：</label>
                <div class="col-sm-8">
                    <input name="director" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">编剧：</label>
                <div class="col-sm-8">
                    <input name="screenwriter" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">主要演员：</label>
                <div class="col-sm-8">
                    <input name="actor" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">集数：</label>
                <div class="col-sm-8">
                    <input name="episodeNum" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">提名理由：</label>
                <div class="col-sm-8">
                    <input name="reasons" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">年代划分：</label>
                <div class="col-sm-8">
                    <select name="chronologicalDivision" class="form-control m-b" th:with="type=${@dict.getType('ds_history')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">链接：</label>
                <div class="col-sm-8">
                    <input name="url" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">影视分类：</label>
                <div class="col-sm-8">
                    <select name="kind" class="form-control m-b" th:with="type=${@dict.getType('ds_kind')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">是否推荐：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('ds_film_recommend')}">
                        <input type="radio" th:id="${'recommend_' + dict.dictCode}" name="recommend" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'recommend_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">获奖信息：</label>
                <div class="col-sm-8">
                    <input name="awardInformation" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">排序值：</label>
                <div class="col-sm-8">
                    <input name="sortNum" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "front/film"
        $("#form-film-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-film-add').serialize());
            }
        }

        $("input[name='annual']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").fileinput({
            uploadUrl: ctx + 'common/upload',
            maxFileCount: 1,
            autoReplace: true
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })
    </script>
</body>
</html>